<template>
	<el-form-item :label="$t('designer.setting.minValue')">
		<el-input-number v-model="minValue" class="hide-spin-button" style="width: 100%"></el-input-number>
	</el-form-item>
</template>

<script>

export default {
	name: "min-editor",
	mixins: [],
	props: {
		designer: Object,
		selectedWidget: Object,
		optionModel: Object,
	},
	computed: {
		minValue: {
			get() {
				return this.optionModel['min']
			},

			set(newValue) {
				//if ((!newValue && (newValue !== 0)) || isNaN(newValue)) {
				if ((newValue === undefined) || (newValue === null) || isNaN(newValue)) {
					this.thisOptionModel.min = null
				} else {
					this.thisOptionModel.min = Number(newValue)
				}
			}
		},
	},
	data() {
		return {
			thisOptionModel: this.optionModel
		}
	},
	watch: {
		'optionModel': {
			handler(val) {
				if (val) {
					this.thisOptionModel = val
				}
			}
		},
	},
}
</script>

<style scoped>

</style>
